<template>
	<view>
		<nav-bar :title="pageTitle"></nav-bar>
		<scroll-view scroll-y :style="{ height: scrollHeight, background: '#FFF', padding: '20rpx 28rpx' }">
			<store-list :storeList="storeList"></store-list>
		</scroll-view>
	</view>
</template>

<script>
	import StoreList from '../components/storeList'
	export default {
		name: 'StoreList',
		components: {
			StoreList
		},
		data() {
			return {
				pageTitle: '',
				scrollHeight: '',
				storeTags: '',
				storeList: [],
				cityObject: {}
			}
		},
		onLoad(options) {
			console.log('传参', options)
			this.pageTitle = options.title + '门店'
			this.storeTags = options.id
			this.scrollHeight = this.$store.getters.heightData.noTabMainHeight + 'px'
			this.cityObject = JSON.parse(options.city)
			const data = {
				storeTags: this.storeTags,
				...this.cityObject
			}
			this.getStoreList(data)
		},
		methods: {
			async getStoreList(datas) {
				const data = {
					...datas
				}
				const res = await this.$GET('/fx/store/listApp', data)
				console.log('城市',res)
				if (res.code == 200) {
					let newArr = res.data.map((item) => {
						item.tegNames = item.tegNames.split(",")
						return item
					})
					this.storeList = newArr
				}
			},
		}
	}
</script>
<style lang="scss" scoped>
</style>